package com.yy.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.entity.ParkingLot;
import com.yy.mapper.ParkingLotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ParkingLotService extends ServiceImpl<ParkingLotMapper,ParkingLot> {
    ParkingLotMapper mapper;

    @Autowired
    public ParkingLotService(ParkingLotMapper mapper) {
        this.mapper = mapper;
    }

    public List<ParkingLot> getAll() {
        List<ParkingLot> results = mapper.getAll();
        return results;
    }

    public ParkingLot getById(Long id) {
        ParkingLot entity = mapper.getById(id);
        return entity;
    }

    public boolean insert(ParkingLot entity) {
        boolean result = mapper.insert(entity) > 0 ? true : false;
        return result;
    }

    public boolean update(ParkingLot entity) {
        boolean result = mapper.update(entity) > 0 ? true : false;
        return result;
    }
    public boolean delete(Long id){
        boolean result = mapper.deleteById(id) > 0? true :false;
        return result;
    }

}
